import queuedemo.MyCircularQueue1;

import java.util.Queue;
import java.util.Stack;

public class Test {
    public int evalRPN(String[] tokens) {
    Stack<Integer> stack=new Stack<>();
        for (String s:
             tokens) {
            if (!isOperations(s)){
                stack.push(Integer.parseInt(s));//字符串转化为数字
            }else {
                int num2=stack.pop();
                int num1=stack.pop();
                switch (s){
                    case "+":
                        stack.push(num1+num2);
                        break;
                    case "-":
                        stack.push(num1-num2);
                        break;
                    case "*":
                        stack.push(num1*num2);
                        break;
                    case "/":
                        stack.push(num1/num2);
                        break;
                }
            }

        }
        return stack.pop();
    }
    public boolean isOperations(String oper){
        if (oper.equals("+")||oper.equals("-")||oper.equals("*")||oper.equals("/")){
            return true;
        }
        return false;
    }
    public boolean isValid(String s) {
        Stack<Character> stack=new Stack<>();
        for (int i = 0; i <s.length() ; i++) {
            char ch=s.charAt(i);
            if (ch=='('||ch=='['||ch=='{'){
                stack.push(ch);
            }else {
                if (stack.isEmpty()){
                return false;
            }
                char ch2=stack.peek();
                if (ch2=='('&&ch==')'||ch2=='{'&&ch=='}'||ch2=='['&&ch==']'){
                    stack.pop();
                }else {
                    return false;
                }
            }
        }
        if (!stack.isEmpty()){
            return false;
        }
        return true;
    }
    public static void main(String[] args) {
        MyCircularQueue1 myCircularQueue1=new MyCircularQueue1(5);
        myCircularQueue1.enQueue(2);
        myCircularQueue1.enQueue(3);
        myCircularQueue1.enQueue(4);
        myCircularQueue1.enQueue(5);
        myCircularQueue1.Rear();



    }
}
